<style>
input{
 width:100px; border: 1px solid silver; padding: 1px;
}
</style>
<div id="main_tab">
	<div id="grid_detil"><table id="data_subitem"></table></div>
	<div id="form_detil" style="display:none;">
		<div id="isi_detil"></div>
		<div region="south" border="false" style="text-align:right;padding:5px 0;">
						<a id="simpan" class="easyui-linkbutton l-btn" iconcls="disk" plain="true" href="#">
							<span class="l-btn-left">
								<span class="l-btn-text disk" style="padding-left: 20px;">Simpan</span>
							</span>
						</a>
						<a id="batal" class="easyui-linkbutton l-btn" onclick="$('#grid_detil').css('display','inline');
								$('#form_detil').css('display','none');" iconcls="cancel" plain="true" href="#">
							<span class="l-btn-left">
								<span class="l-btn-text cancel" style="padding-left: 20px;">Batal</span>
							</span>
						</a>
		</div>
	</div>
</div>

<script type="text/javascript">
	/*$('#main_tab').tabs({
		border:true,
		height:getClientHeight()-350,
		onSelect:function(title){
			//alert(title+' is selected');
		}
	});*/
	var tabel_na
	tabel_na=$("#data_subitem").datagrid({        
		title:'Data Item Barang Diterima',
        height:getClientHeight()-300,
        width:getClientWidth()-330,
		iconCls: 'table',
		rownumbers:true,
        fit:false,
        striped:true,
        pagination:true,
        sortable:true,
        url:host+"procurement/get_data/tbl_subdetil_penerimaan",		
		nowrap: false,
        singleSelect:true,
		pageNumber:'1',
		pageSize:10,
		queryParams:{
			id:<?=$id_penerimaan?>
		},
		frozenColumns:[[
			{field:'ck', checkbox:true},
			{field:'id',title:'.::.',hidden:false,width:50,align:'center',
				formatter:function(value,rowData,rowIndex){
				
					return '<a href="javascript:void(0)" onClick="get_subform(\''+rowData.id+'\',\''+rowData.qty_diterima+'\',\''+rowData.kategori_barang+'\',\''+rowData.satuan_barang+'\',\''+rowData.nama_barang+'\')" style="" title="Tambah / View Item Barang Rinci"><img src="'+host+'assets/css/themes_easyui/icons/eye.png" ></a>';
				}
			
			},
            {field:'nama_barang',title:'Nama Barang',hidden:false,width:250},         
		]],	
        columns:[[
             {field:'kategori_barang',title:'Kategori Barang',hidden:false,width:200},
			 {field:'merek_barang',title:'Merk Barang',hidden:false,width:150},
			 {field:'qty',title:'Total Qty',hidden:false,width:80,align:'right'},
			 {field:'satuan_barang',title:'Satuan',hidden:false,width:80,align:'center'},
			 {field:'qty_diterima',title:'Qty Diterima',hidden:false,width:80,align:'right'},
			 {field:'qty_sisa',title:'Qty Sisa',hidden:false,width:80,align:'right'},
        ]],
		
	});
	
	
	$('#simpan').die();
	$('#simpan').live('click',function(){
		loadingna();
		submit_form('form_subdetil',function(r){
			console.log(r);
			if(r==1){
				$.messager.alert('Save Data','Data Sudah Tersimpan','info');
				$('#grid_detil').css('display','inline');
				$('#form_detil').css('display','none');
			}		
			else{//$.messager.alert('Save Data','Gagal Simpan Cek Atribut Penginputan','error');
				$.messager.alert('Save Data',r,'error');
			}
			winLoadingClose();
		});
	});
	
</script>